/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package io.renren.modules.sys.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.sys.entity.SysUserEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * 系统用户
 *
 * @author Mark sunlightcs@gmail.com
 */
@Mapper
public interface SysUserDao extends BaseMapper<SysUserEntity> {

	@Select("select * from sys_user where dept_id=#{deptId}")
	List<SysUserEntity> findByDeptId(@Param("deptId") Long deptId);

	/**
	 * 包含分类号和所在地
	 * @return
	 */
    @ResultType(io.renren.modules.sys.entity.SysUserEntity.class)
	@Select("select * from sys_user where dept_id=#{deptId}")
    @Results({
            @Result(column = "user_id",property = "flhs",many = @Many(select = "io.renren.modules.dangan.dao.DaUserFlhDao.findByUserId")),
            @Result(column = "user_id",property = "szds",many = @Many(select = "io.renren.modules.dangan.dao.DaUserLocationDao.findByUserId")),
            @Result(column = "user_id",property = "roleIds",many = @Many(select = "io.renren.modules.sys.dao.SysUserRoleDao.queryRoleIdList")),
            @Result(column = "user_id",property = "userId")
    })
	List<SysUserEntity> findUserDetailByDeptId(@Param("deptId") Long deptId);
	/**
	 * 查询用户的所有权限
	 * @param userId  用户ID
	 */
	List<String> queryAllPerms(Long userId);
	
	/**
	 * 查询用户的所有菜单ID
	 */
	List<Long> queryAllMenuId(Long userId);

}
